package synchro;

import java.io.File;
import java.io.IOException;

/**
 * @author DELL
 * @create 2017-09-22 17:48
 */
public class TestLogfile {
    public static void main(String[] args) throws IOException, InterruptedException {
        LogFile logFile = new LogFile(new File("src/file/log1.txt"));
        LogFileThread log1 = new LogFileThread(logFile, "good morning");
        LogFileThread log2 = new LogFileThread(logFile, "good afternoon");
        LogFileThread log3 = new LogFileThread(logFile, "good evening");
        Thread t1 = new Thread(log1);
        t1.sleep(10);
        Thread t2 = new Thread(log2);
        t2.sleep(20);
        Thread t3 = new Thread(log3);
        t3.sleep(10);
        t1.start();
        t2.start();
        t3.start();

        Thread.sleep(1000);
        logFile.close();
    }
}
